<template>
  <el-form-item label="卡片查找">
    <el-col :span="8">
      <el-input :value="value" @input="input" placeholder="填写卡片或iccid号段，例：17011552255-17011552275" />
    </el-col>
    <el-button style="margin-left: 10px" size="small" type="primary" @click="getCards">查询</el-button>
  </el-form-item>
</template>

<script>
import { getCards } from '@/api/card';

export default {
  model: {
    prop: 'value',
    event: 'input',
  },
  props: {
    value: String,
  },
  methods: {
    input(e) {
      this.$emit('input', e);
    },
    async getCards() {
      const res = await getCards({
        form: {
          code_zone: this.value,
        },
      });
      this.$message({ message: `查询到${res.data.count}条卡片数据` });
      this.$emit('getCardsCb', res);
    },
  },
};
</script>

<style>
</style>